<?php
session_start();
ob_start();
date_default_timezone_set('PRC');
//var_dump($_POST);exit;
$error='';
$name = $_POST['name'];
$password = $_POST['password'];

	//将内容插入到数据库中
	if(empty($error)){
		include 'config.php';
		$link=mysql_connect(HOST,DBUSER,DBPASS) or die('数据库连接失败');
		mysql_select_db(DBNAME,$link);
		mysql_set_charset('utf8');
		$sql= "SELECT * FROM t_manager WHERE name='".$name."' AND password = '".$password."'";
		$result=mysql_query($sql);
		if($result!=null&&mysql_num_rows($result)>0){
			while($rows = mysql_fetch_assoc($result)){
			
			}
		}else{
			$error = "登陆名或密码错误，请重新登陆";
		}
		mysql_close($link);
	}
	//错误跳转
	if(empty($error)){
		 echo "<script>window.top.location.href='index.php';</script>"; 
	}else{
		header('Location:login.php?error='.$error);
	}
	ob_end_flush();
	?>